program chapter9_4
    !considering format usage in this programme
    implicit none
    integer na,x,p,i
    parameter (na=20)
    integer a(na)
    do i=1,20
        a(i)=i
    end do
    print*, 'input a number for research'
    read *, x
    write(*,10) (a(i),i=1,na)
10 format (/1x,'original array':// (1x, 5i6))!careful here

    !write(*,num) then, num format(something u want declare)
    !usage example
    !format(1x,i2,i3,i4,2x,i2,i2) variables<=5 if more than 5 then format is not enough
    !format(/) / means change a line which means enter(the function is similar)\
    !format()// two slashes? change line for two times \
    !format (5i2) used in array outputing

    p=1
    do while(x .ne. a(p) .and. p .lt. na)
        p=p+1
    end do
    if (x .eq. a(p) .and. p .lt. na) then
        write(*,20) x,p
20    format(9x,i3,'is on',i3,'th position')
    else
        print*, x,'could not be found'
    end if
end program

